from flask import  Flask
from flask_sqlalchemy import SQLAlchemy
from redis import StrictRedis
from flask_wtf.csrf import CSRFProtect
from flask_session import Session
from flask import session
import pymysql
pymysql.install_as_MySQLdb()

class Config():
    DEBUG= True
    SQLALCHEMY_DATABASE_URI='mysql://root:123456@127.0.0.1:3306/haha'
    SQLALCHEMY_TRACK_MODIFICATIONS=True
    REDIS_HOST= "127.0.0.1"
    REDIS_PORT = 6379
    SESSION_REDIS ='redis'
    SESSION_KEY_PREFIX =StrictRedis(host=REDIS_HOST,port=REDIS_PORT,db=1)
    SESSION_USE_SIGNER =True
    SESSION_PERMANENT=False
    PERMANENT_SESSION_LIFETIME = 86400
    SECRET_KEY="AASFSDSHSFGJDFJGDHK"





app =Flask(__name__)
app.config.from_object(Config)
db =SQLAlchemy(app)
redis_store =StrictRedis(host=Config.REDIS_HOST ,port=Config.REDIS_PORT ,decode_responses = True)
CSRFProtect(app)
Session(app)




@app.route('/')
def haihai():
    print('haihai')
if __name__ == '__main__':
    app.run()